package StudyCode.summary.myfile;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class FileWritingBytes {
	public static void main(String[] args) {
		Path ballPath = Paths.get("E:\\Copy", "ball.png");
		byte[] ball_bytes = new byte[]{(byte) 0x89, (byte) 0x50, (byte) 0x4e,
				(byte) 0x47, (byte) 0x0d, (byte) 0x0a, (byte) 0x1a, (byte) 0x0a,
				(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0d, (byte) 0x49,
				(byte) 0x60, (byte) 0x82};
		try {
			Files.write(ballPath, ball_bytes);
			System.out.println("写入成功。");
		} catch (IOException e) {
			System.err.println(e);
		}
	}
}
